//
//  XRButton.m
//  TongMiBaby
//
//  Created by 史伟文 on 15/4/3.
//  Copyright (c) 2015年 XuanRuiTechnology. All rights reserved.
//

#import "XRButton.h"

@implementation XRButton

- (void)addTarget:(ClickButton)block {
    _clickAction = block;
    [self addTarget:self action:@selector(touchAction:) forControlEvents:0x40];
}

- (void)setTitle:(NSString *)title andTarget: (ClickButton)block
{
    [self setTitle:title forState:UIControlStateNormal];
    _clickAction = block;
    [self addTarget:self action:@selector(touchAction:) forControlEvents:0x40];
}

- (void)touchAction: (id)sender {
    self.clickAction(self);
}
@end
